<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  
  <meta name="generator" content="Hugo 0.98.0" />

  
  <meta name="description" content="走在通往幸福的路上">
  

  
  <link rel="apple-touch-icon" sizes="180x180" href="https://blog.v5u.win/apple-touch-icon.png">

  
  <link rel="icon" type="image/png" sizes="32x32" href="https://blog.v5u.win/favicon-32x32.png">

  
  <link rel="icon" type="image/png" sizes="16x16" href="https://blog.v5u.win/favicon-16x16.png">

  
  <link rel="manifest" href="https://blog.v5u.win/site.webmanifest">

  
  <link rel="mask-icon" href="https://blog.v5u.win/safari-pinned-tab.svg" color="">

  <meta name="msapplication-TileColor" content="">

  <meta name="theme-color" content="">

  
  <link rel="stylesheet" href="https://blog.v5u.win/css/bootstrap.min.css" />

  
  <title>Xcode清缓存 | 为吾优</title>
  

  <style>
body {
  min-width: 300px;
}

.custom-navbar {
  margin-bottom: 1em;
  height: 60px;
}

.custom-navbar a {
  display: inline-block; 
  padding: 18px 0;
  margin-right: 1em; 
  font-weight: bold; 
}

.custom-navbar a:hover,
.custom-navbar a:focus {
  text-decoration: none; 
}

@media print {
  .custom-navbar {
    display: none;
  }
}

article {
  padding-bottom: 1em;
}

img {
  max-width: 100%;
}


body {
  background-color: #fff;
}



body {
  color: #212529;
}



a {
  color: #007bff;
}



a:hover,
a:focus {
  color: #0056b3;
}



.custom-navbar {
  background-color: #212529;
}



.custom-navbar a {
  color: rgba(255,255,255,.75);
}



.custom-navbar a:hover,
.custom-navbar a:focus {
  color: rgba(255,255,255,1);
}



.container {
  max-width: 800px;
}





</style>
</head>

<body>
  <nav class="custom-navbar">
  <div class="container">
    
    <a href="/">文章</a>
    
    <a href="/tags/">标签</a>
    
    <a href="/about/">关于</a>
    
    <a href="/index.xml">RSS</a>
    
  </div>
</nav>
  
  <div class="container">
    <article>
      <h1>Xcode清缓存</h1>
<p>列出所有的xcode 模拟器</p>
<p><code>xcrun simctl list devices</code></p>
<p><code>xcrun simctl list devices</code></p>
<p>或</p>
<p><code>xcrun simctl list --json</code>
列出所有模拟器</p>
<p><code>xcrun simctl delete </code></p>
<p>删除特定设备</p>
<p><code>xcrun simctl delete unavailable</code></p>
<p>删除不再支持的运行时的旧设备</p>
<p>xcrun可以执行更多操作(请参见代码段)</p>
<p>删除完重启xcode
Xcode清理缓存</p>
<h5 id="模拟器">模拟器</h5>
<p><code>~/Library/Developer/CoreSimulator</code></p>
<h5 id="caches-清空">Caches 清空</h5>
<p>Devices 保留device_set.plist文件，其余可清空，运行时候可生成</p>
<h5 id="xcode">Xcode</h5>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>~/Library/Developer/Xcode
</span></span><span style="display:flex;"><span>Archives 这是项目的打包文件，要在移动硬盘做备份，方便后续定位bug用到。
</span></span><span style="display:flex;"><span>DerivedData 编译的中间文件，可以删除后，重新生成
</span></span><span style="display:flex;"><span>DocumentationCache 可删除
</span></span><span style="display:flex;"><span>iOS Device Logs 设备日志，可删除
</span></span><span style="display:flex;"><span>iOS DeviceSupport 存放的是真机调试的内容
</span></span></code></pre></div><p>测试机</p>
<blockquote>
<p>~/Library/Developer/XCTestDevices
可清空文件夹
Playground
XCPGDevices playground 的项目缓存，可删除</p>
</blockquote>
<p>删除Xcode无用的模拟器和架构</p>
<blockquote>
<p>Add and remove simulators only through Xcode &gt; Settings &gt; Components</p>
</blockquote>
<h5 id="真机缓存">真机缓存</h5>
<p><code>private/var/folders/(xx/xx)/com.apple.DeveleperTools/All/Xcode/EmbeddedAppDeltas /private/var/folders/zt/55wjgcps3qn_mc_3ymr88d5r0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas</code></p>
<p>这个文件夹中是真机测试时安装程序的详情，程序猿的Mac如果长期不清理这个文件夹，它能把硬盘的空间吃光。作者：梁间链接：https://www.jianshu.com/p/aad276dc1739来源：简书著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。</p>
<h2 id="target-other-unnecessary-filespermalink">Target: Other unnecessary filesPermalink</h2>
<p>Path: ~/Library/Caches/..
How: delete each directory</p>

    </article>
  </div>

  
  
  

  
</body>

</html>